<?php

//create a connection to the database
$db = new MySql('table');	//'table' refers to the table to use by default

//select some values
$db->select("id,name,date", "WHERE date > $somedatevar"); 	//note that select does *not* clean variables
								//as the arguments are strings
//get columns by name or index
$names = $db->get_col('name');
$dates = $db->get_col(2);

for ($i = 0; $i < $db->num_rows(); $i++); {
	//get rows by index
	$row = $db->get_row($i);

	//get variables by index or name
	$name = $db->get_var('name', $i);
	$date = $db->get_var(2, $1);
}

//insert values into the database
$db->insert('name,date', array($_POST['name'], $_POST['date']); //values are cleaned automatically
								//optionally pass third arg as true to prevent var cleaning

//delete stuff from the database
$db->remove(13);			//DELETE FROM table WHERE id = 13
					//if just int is passed, will use default column name of id;
$db->remove("date<'$somedate'");	//DELETE FROM table WHERE date<'$somedate'
					//WHERE is added automatically
$db->remove("WHERE date<'$somedate'");	//DELETE FROM table WHERE date<'$somedate'

//update rows (note that the first argument is identical to argument for $db->remove )
$db->update("name = 'john doe'", "name, date", array("jane doe", "NOW()");	//UPDATE table SET name='jane doe' AND date='NOW()' WHERE name='john doe'

?>